﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace ICeFramework.Common.Utilities.Google
{
    public class StringValueAttribute : Attribute
    {
        public string StringValue;

        public StringValueAttribute(string value)
        {
            this.StringValue = value;
        }
    }

    public static class EnumStringUtil
    {
        public static string GetStringValue(Enum value)
        {
            // Get the type
            Type type = value.GetType();

            // Get fieldinfo for this type
            FieldInfo fieldInfo = type.GetField(value.ToString());
            // Get the stringvalue attributes
            StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes(
                typeof(StringValueAttribute), false) as StringValueAttribute[];
            // Return the first if there was a match.
            return attribs.Length > 0 ? attribs[0].StringValue : null;
        }

    }

    public enum VERSION
    {
        [StringValue("1.0")]
        ONE_POINT_ZERO
    }

    public enum LANGUAGE
    {
        [StringValue("")]
        UNKNOWN = 0,
        [StringValue("af")]
        Afrikaans = 1,
        [StringValue("sq")]
        Albanian = 2,
        [StringValue("ar")]
        Arabic = 3,
        [StringValue("be")]
        Belarusian = 4,
        [StringValue("bg")]
        Bulgarian = 5,
        [StringValue("ca")]
        Catalan = 6,
        [StringValue("zh")]
        Chinese = 7,
        [StringValue("hr")]
        Croatian = 8,
        [StringValue("cs")]
        Czech = 9,
        [StringValue("da")]
        Danish = 10,
        [StringValue("nl")]
        Dutch = 11,
        [StringValue("en")]
        English = 12,
        [StringValue("et")]
        Estonian = 13,
        [StringValue("tl")]
        Filipino = 14,
        [StringValue("fi")]
        Finnish = 15,
        [StringValue("fr")]
        French = 16,
        [StringValue("gl")]
        Galician = 17,
        [StringValue("de")]
        German = 18,
        [StringValue("el")]
        Greek = 19,
        [StringValue("ht")]
        HaitianCreole = 20,
        [StringValue("iw")]
        Hebrew = 21,
        [StringValue("hi")]
        Hindi = 22,
        [StringValue("hu")]
        Hungarian = 23,
        [StringValue("is")]
        Icelandic = 24,
        [StringValue("id")]
        Indonesian = 25,
        [StringValue("ga")]
        Irish = 26,
        [StringValue("it")]
        Italian = 27,
        [StringValue("ja")]
        Japanese = 28,
        [StringValue("ko")]
        Korean = 29,
        [StringValue("lv")]
        Latvian = 30,
        [StringValue("lt")]
        Lithuanian = 31,
        [StringValue("mk")]
        Macedonian = 32,
        [StringValue("ms")]
        Malay = 33,
        [StringValue("mt")]
        Maltese = 34,
        [StringValue("no")]
        Norwegian = 35,
        [StringValue("fa")]
        Persian = 36,
        [StringValue("pl")]
        Polish = 37,
        [StringValue("pt")]
        Portuguese = 38,
        [StringValue("ro")]
        Romanian = 39,
        [StringValue("ru")]
        Russian = 40,
        [StringValue("sr")]
        Serbian = 41,
        [StringValue("sk")]
        Slovak = 42,
        [StringValue("sl")]
        Slovenian = 43,
        [StringValue("es")]
        Spanish = 44,
        [StringValue("sw")]
        Swahili = 45,
        [StringValue("sv")]
        Swedish = 46,
        [StringValue("th")]
        Thai = 47,
        [StringValue("tr")]
        Turkish = 48,
        [StringValue("uk")]
        Ukrainian = 49,
        [StringValue("vi")]
        Vietnamese = 50,
        [StringValue("cy")]
        Welsh = 51,
        [StringValue("yi")]
        Yiddish = 52,
    }

    public enum BASEURL
    {
        [StringValue("http://ajax.googleapis.com/ajax/services/language/translate")]
        TRANSLATE = 0,
        [StringValue("http://ajax.googleapis.com/ajax/services/language/detect")]
        DETECT = 1
    }
}
